<?php
    $func = explode(".",explode("/",$_SERVER["REQUEST_URI"])[1])[0];
?>
<link rel="stylesheet" href="https://file.viplgw.cn/ui/thinku-ielts-new/css/ucenter/common.css?v=1.2">
<!--发票弹窗-->
<div class="fapiao" id="fapiao"
     style="position: fixed;top: 0;left: 0;width: 100%;height: 100%;z-index: 999;background: rgba(0,0,0,0.5);display: none;">
    <div style="padding:15px 30px;width: 570px;height: 640px;border-radius: 20px;background: url('https://file.viplgw.cn/ui/public/img/rece_bj.png') no-repeat;background-size: cover;position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);">
        <img src="https://file.viplgw.cn/ui/public/img/rece_close.png" alt=""
             style="cursor: pointer;position: absolute;right: -40px;top: -30px;"
             onclick="javascript:$('.fapiao').hide();">
        <img src="https://file.viplgw.cn/ui/public/img/rece_pic.png" alt=""
             style="position: absolute;right: 10px;top: 10px;">
        <p style="display: flex;align-items: center">
            <img src="https://file.viplgw.cn/ui/public/img/rece_ding.png" alt="">
            <span style="font-weight: bold;font-size: 25px;color: #33378D;margin-left: 15px">关于开票事宜的温馨提醒</span>
        </p>
        <div style="width: 510px;height: 504px;background: #FFFFFF;box-shadow: 0px 0px 9px 0px rgba(3,0,0,0.14);border-radius: 10px;margin: 10px 0;padding: 15px;overflow-y: auto;">
            <p style="font-size: 14px;margin-bottom: 10px;line-height: 20px;">尊敬的客户：</p>
            <p style="font-size: 14px;margin-bottom: 10px;line-height: 20px;">您好!</p>
            <p style="font-size: 14px;margin-bottom: 10px;line-height: 20px;">
                感谢您选择我们的产品和服务。为了确保您的权益和我们的财务流程顺利进行，我们特此向您发出关于开票事宜的温馨提醒。</p>
            <p style="font-size: 14px;margin-bottom: 10px;line-height: 20px;"><span
                        style="color: #FE5B00">开具发票</span>:若您需要开具发票，请您在购买产品或服务后，通过自动通道申请开具增值税电子普通发票，请务必核对您的开票信息是否准确认无误。如开票名称、身份证号/税
                号、地址、电话等，避免因信息错误导致开票延误或退票。请确保您提供的邮箱地址准确无误，系统通过电子邮件发送电子发票；如需开具增值税专用发票或有其他要求请与顾问联系。
            </p>
            <p style="font-size: 14px;margin-bottom: 10px;line-height: 20px;"><span
                        style="color: #FE5B00">发票保管</span>:请您妥善保管好发票，以备税务部门查验或单位报销使用。若发票遗失或损
                坏，我们将无法为您补开。</p>
            <p style="font-size: 14px;margin-bottom: 10px;line-height: 20px;">如您有任何关于开票的问题或疑虑，请随时联系我们的客服人员，我们将竭诚为您服务。
                再次感谢您对我们产品和服务的信任与支持，期待与您长期合作!</p>
            <div style="display: flex;align-items: center;width: 381px;height: 45px;background: #FFFFFF;border-radius: 25px;border: 1px solid #D2D2D2;padding: 0 30px;margin: 10px auto 0;">
                <span style="font-size: 14px;color: #888888;margin-right: 5px;">姓名:</span>
                <input type="text" class="nameBox" v-model="name" style="flex: 1;outline:none;border: none">
            </div>
            <div style="display: flex;align-items: center;width: 381px;height: 45px;background: #FFFFFF;border-radius: 25px;border: 1px solid #D2D2D2;padding: 0 30px;margin: 10px auto 0;">
                <span style="font-size: 14px;color: #888888;margin-right: 5px;">电话:</span>
                <input type="text" class="phoneBox" v-model="phone" style="flex: 1;outline:none;border: none">
            </div>
            <div style="display: flex;align-items: center;width: 381px;height: 45px;background: #FFFFFF;border-radius: 25px;border: 1px solid #D2D2D2;padding: 0 30px;margin: 10px auto 0;">
                <span style="font-size: 14px;color: #888888;margin-right: 5px;">邮箱:</span>
                <input type="text" class="emailBox" v-model="email" style="flex: 1;outline:none;border: none">
            </div>
            <div style="display: flex;align-items: center;width: 381px;height: 45px;margin: 10px auto 0;">
                <label for="radio" style="font-size: 14px;margin-right: 10px">专票</label>
                <input type="radio" id="radio" value="专票" v-model="type" name="r" style="margin-right: 10px;appearance:auto;">
                <label for="radio1" style="font-size: 14px;margin-right: 10px">普票 </label>
                <input type="radio" id="radio1" value="普票" v-model="type" name="r" style="appearance:auto;">
            </div>
            <div style="display: flex;align-items: center;width: 381px;height: 45px;margin: 10px auto 0;" v-if="type === '普票'">
                <label for="radio" style="font-size: 14px;margin-right: 10px">个人</label>
                <input type="radio" id="radio" value="个人" v-model="nature" name="r1" style="margin-right: 10px;appearance:auto;">
                <label for="radio1" style="font-size: 14px;margin-right: 10px">公司 </label>
                <input type="radio" id="radio1" value="公司" v-model="nature" name="r1" style="appearance:auto;">
            </div>
            <div style="display: flex;align-items: center;width: 381px;height: 45px;background: #FFFFFF;border-radius: 25px;border: 1px solid #D2D2D2;padding: 0 30px;margin: 10px auto 0;" v-if="type === '专票' || (type === '普票' && nature === '公司')">
                <span style="font-size: 14px;color: #888888;margin-right: 5px;">公司名:</span>
                <input type="text" class="emailBox" v-model="complany" style="flex: 1;outline:none;border: none">
            </div>
            <div style="display: flex;align-items: center;width: 381px;height: 45px;background: #FFFFFF;border-radius: 25px;border: 1px solid #D2D2D2;padding: 0 30px;margin: 10px auto 0;" v-if="type === '专票' || (type === '普票' && nature === '公司')">
                <span style="font-size: 14px;color: #888888;margin-right: 5px;">税号:</span>
                <input type="text" class="emailBox" v-model="dutyParagraph" style="flex: 1;outline:none;border: none">
            </div>
        </div>
        <p class="fapiaoBtn"
           style="width: 257px;height: 49px;background: linear-gradient(0deg, #595EC7 0%, #765CD5 100%);border-radius: 25px;font-weight: bold;font-size: 20px;color: #FFFFFF;line-height: 49px;text-align: center;margin: auto;cursor: pointer;"
           @click="getFapiao()">
            立即申请发票</p>
    </div>
</div>
<div id="ucenterLeft">
    <div class="levelOne"><img src="https://file.viplgw.cn/ui/thinku-ielts-new/images/user/icon1@2x.png" alt=""><p>个人中心</p></div>
    <a onclick="_czc.push(['_trackEvent','个人中心','个人资料','',''])" href="/ucenter.html" class="levelTwo <?php echo $func=='ucenter'?'on':''?>">个人资料</a>
    <a onclick="_czc.push(['_trackEvent','个人中心','会员积分','',''])" href="/member.html" class="levelTwo <?php echo $func=='member'?'on':''?>">会员积分</a>
    <a onclick="_czc.push(['_trackEvent','个人中心','密码安全','',''])" href="/password.html" class="levelTwo <?php echo $func=='password'?'on':''?>">密码安全</a>
    <a onclick="javascript:$('.fapiao').show();" href="javascript:;" class="levelTwo">发票申请</a>
    <div class="levelOne"><img src="https://file.viplgw.cn/ui/thinku-ielts-new/images/user/icon2@2x.png" alt=""><p>我的订单</p></div>
    <a onclick="_czc.push(['_trackEvent','个人中心','我的订单','',''])" href="/order.html" class="levelTwo <?php echo $func=='order'?'on':''?>">我的订单</a>
    <div class="levelOne"><img src="https://file.viplgw.cn/ui/thinku-ielts-new/images/user/icon3@2x.png" alt=""><p>我的课程</p></div>
    <a onclick="_czc.push(['_trackEvent','个人中心','全部课程','',''])" href="/my-course.html" class="levelTwo <?php echo $func=='my-course'?'on':''?>">全部课程</a>
    <a onclick="_czc.push(['_trackEvent','个人中心','我的课表','',''])" href="/timetable.html" class="levelTwo <?php echo $func=='timetable'?'on':''?>">我的课表</a>
    <div class="levelOne"><img src="https://file.viplgw.cn/ui/thinku-ielts-new/images/user/icon4@2x.png" alt=""><p>我的练习</p></div>
    <a onclick="_czc.push(['_trackEvent','个人中心','做题记录','',''])" href="/record.html" class="levelTwo <?php echo $func=='record'?'on':''?>">做题记录</a>
    <a onclick="_czc.push(['_trackEvent','个人中心','模考记录','',''])" href="/mock/record.html" class="levelTwo <?php echo $func=='mock'?'on':''?>">模考记录</a>
    <a onclick="_czc.push(['_trackEvent','个人中心','题目收藏','',''])" href="/collect.html" class="levelTwo <?php echo $func=='collect'?'on':''?>">题目收藏</a>
    <div class="levelOne"><img src="https://file.viplgw.cn/ui/thinku-ielts-new/images/user/icon5@2x.png" alt=""><p>我的消息</p></div>
    <a onclick="_czc.push(['_trackEvent','个人中心','系统消息','',''])" href="/message.html" class="levelTwo <?php echo $func=='message'?'on':''?>">系统消息</a>
</div>
<script>
    window.fapiao = new Vue({
        el: '#fapiao',
        data() {
            return {
                name: '',
                phone: '',
                email: '',
                type: '普票',
                nature: '个人',
                complany: '',
                dutyParagraph: '',
                uid:'<?php echo $_SESSION['userData']['phone']?>',
            }
        },
        created() {

        },
        mounted() {

        },
        methods: {
            getFapiao() {
                let that = this
                $('.fapiaoBtn').hide()
                if (this.name.trim().length == 0) {
                    alert('请填写姓名!')
                    $('.fapiaoBtn').show()
                    return
                }
                if (this.phone.trim().length != 11) {
                    alert('请填写11位电话!')
                    $('.fapiaoBtn').show()
                    return
                }
                if (this.email.trim().indexOf('@') == -1) {
                    alert('请填写正确的邮箱!')
                    $('.fapiaoBtn').show()
                    return
                }
                if(this.type === '专票' || (this.type === '普票' && this.nature === '公司')){
                    if(this.complany.trim() == '' || this.dutyParagraph.trim() == ''){
                        alert('公司名字以及税号!')
                        $('.fapiaoBtn').show()
                        return
                    }
                }
                $.post('https://api-crm.viplgw.cn/fresh/api/add-invoice', {
                    name: that.name,
                    phone: that.phone,
                    email: that.email,
                    uid: that.uid,
                    type: that.type,
                    nature: that.nature,
                    complany: that.nature === '公司'?that.complany:'',
                    dutyParagraph: that.nature === '公司'?that.dutyParagraph:'',
                }, function (res) {
                    if (res.code == 1) {
                        alert('提交成功')
                        $('.fapiao').hide()
                    } else {
                        $('.fapiaoBtn').show()
                    }
                }, 'json')
            },
        }
    });

</script>

<script src="https://file.viplgw.cn/ui/thinku-ielts-new/js/ucenter/common.js"></script>
